import Cookies from 'js-cookie'
import JSEncrypt from 'jsencrypt/bin/jsencrypt'

const TokenKey = 'Admin-Token'

const TYPE='77TSA1WYSHADGSDGAV'

const prKey="MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMqNkppAlhGK/fod" +
"Gk3GM7xnpwYad2NDa7OkWxPjmwbnAt85LUcdO8tsP52rteoOHUecWeEqS/mlhAFB" +
"rYvAoIeXDjJx0mzhUJ7TbYnWCezYpd06Rq5KsZ7wMdemsLw0cK9h78GspXLdjPyL" +
"xfx5G4M+E36rgwZajcUjB4qfpfMVAgMBAAECgYBBnjGDFS9IiZ2TnD/8OBxkibO7" +
"L3HDz4ChlroGrHJ5fvcYN56qbhcD5JKLUqhBJcdofodDgX9RZcRo380H/CRElQ+s" +
"92qTs3BqHTO7PRPaM11oDUWpV9uDdFNPRaeL+Pm4V2V8/t6NyJXcYR2KnsBpy0u+" +
"tirYeKD6AZOR+bB0AQJBAOxVIMvCKiUtzncEBqr73j9KGdZFouaMCkoAQGlzK6xG" +
"WSq4sNyH5QZ/p7MG7nvRGcd8DfnFIYVlB791ZG77EBUCQQDbaMywVIr2D3qAcV5n" +
"+FNQZrTs0+2/LFRMZt3+vB25EEm8ApjnzW8ULXQ1mszG7vubly/ZKghvCTBXe2Ou" +
"lRcBAkEA2a936/dG9sQAn2PX+HrTNhy9O78c05s+hvdAXWE2YxLRYyaH0jpiXOAM" +
"yjyiQu5R/otoHB7WR5bN0i8BebBMGQJAA0fp56kb+tn4ZvtLAhsAg+9FPVVd9MHg" +
"8NOI9kox15aaw6j2SGEWDCMx3atW7JKeSJFWMdUjEyX8BxLdRrsMAQJBAImlbZ8S" +
"oz4xUkooDd2KNOFDKxQKprKhUaB70u5375LvrUAkngcO82BAMFfL3Qy/1rTU1Ih0" +
"YOTbh1VeN9udfD8="

export function getToken() {
  return Cookies.get(TokenKey)
}
// 解密
export function getType(){
  
  let decrypt = new JSEncrypt()
  decrypt.setPrivateKey(prKey)
  // console.log(Cookies.get(TYPE))
  // console.log(decrypt.decrypt(Cookies.get(TYPE)))
  return decrypt.decrypt(Cookies.get(TYPE))
  
}
export function setType(type){
  return Cookies.set(TYPE, type)
}



export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
